package cn.lopr.im.android.db.gen;

import java.util.Map;

import org.greenrobot.greendao.AbstractDao;
import org.greenrobot.greendao.AbstractDaoSession;
import org.greenrobot.greendao.database.Database;
import org.greenrobot.greendao.identityscope.IdentityScopeType;
import org.greenrobot.greendao.internal.DaoConfig;

import cn.lopr.im.android.db.entity.HomeDialogue;
import cn.lopr.im.android.db.entity.Message;

import cn.lopr.im.android.db.gen.HomeDialogueDao;
import cn.lopr.im.android.db.gen.MessageDao;

// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.

/**
 * {@inheritDoc}
 * 
 * @see org.greenrobot.greendao.AbstractDaoSession
 */
public class DaoSession extends AbstractDaoSession {

    private final DaoConfig homeDialogueDaoConfig;
    private final DaoConfig messageDaoConfig;

    private final HomeDialogueDao homeDialogueDao;
    private final MessageDao messageDao;

    public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
            daoConfigMap) {
        super(db);

        homeDialogueDaoConfig = daoConfigMap.get(HomeDialogueDao.class).clone();
        homeDialogueDaoConfig.initIdentityScope(type);

        messageDaoConfig = daoConfigMap.get(MessageDao.class).clone();
        messageDaoConfig.initIdentityScope(type);

        homeDialogueDao = new HomeDialogueDao(homeDialogueDaoConfig, this);
        messageDao = new MessageDao(messageDaoConfig, this);

        registerDao(HomeDialogue.class, homeDialogueDao);
        registerDao(Message.class, messageDao);
    }
    
    public void clear() {
        homeDialogueDaoConfig.clearIdentityScope();
        messageDaoConfig.clearIdentityScope();
    }

    public HomeDialogueDao getHomeDialogueDao() {
        return homeDialogueDao;
    }

    public MessageDao getMessageDao() {
        return messageDao;
    }

}
